import Mock from 'mockjs'
import {param2Obj} from '../utils/urlutils.js'
let List = []
for (let i = 0; i < 100; i++) {
    List.push({
        id:Mock.mock('@increment'),
        status: '待接诊',
        num:Mock.mock('@increment(1000)'),
        sex: '男',
        age: Mock.mock('@natural(5, 90)'),
        phoneNum: 18674203663,
        mzType: '初诊',
        house: '全科',
        doctor: Mock.Random.cname(),
        date: Mock.mock('@datetime()'),
        name: Mock.Random.cname()
    })
}
export default {
    getUserdata: (config) => {
        let { page,pageSize } = param2Obj(config.url)
        let pageRes = List.filter((item, index) => {
            return (page-1)*pageSize<=index&&index<page*pageSize
        })

        return {
            code: 200,
            msg: 'user-ok',
            data: pageRes,
            total:List.length
        }
        
    }
}